class Solution:
    def removeDuplicates(self, nums) -> int:
        for i in range(len(nums)-1, 0, -1):
            if nums[i] == nums[i-1]:
                nums.pop(i)
        print(nums)
        return len(nums)

if __name__ == '__main__':
    s = Solution()
    # L = [0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4]
    # L = [1, 1, 2]
    # L = []
    # L = [1]
    L = [1, 1, 1, 1, 1]
    result = s.removeDuplicates(L)
    print(result)